home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 038a / bas_int1.zip / PRINTER.BAS < prev    next >
BASIC Source File  |  1991-05-28  |  1KB  |  40 lines

  1. '===================================================================
  2. ' Quick Basic Forum
  3. '   Date : 13-May-91
  4. '   From : David Rice
  5. 'Subject : printer status; error messages
  6. '=================================================================
  7. err.code% = 1
  8. call printer.check(err.code%)
  9. '
  10. ' Snibbit by Robert Campbell.
  11. ' sub-program : printer.check(err.code%)
  12. ' purpose : check the status of the printer and return any errors
  13. ' inputerr.code% : the line printer port to be tested (lpt1 = 1)
  14. ' output   err.code% : returns 0 if printer is ready
  15. '          err.code% = 8   Printer I/O Error
  16. '          err.code% = 32  The Printer is Out Of Paper
  17. '          err.code% = 16  The Printer is Off Line
  18. '
  19. sub printer.check(err.code%) static
  20.    defint a-z
  21.    if err.code% = 0 then err.code% = 1
  22.  
  23.    dim inary%(7),outary%(7)
  24.  
  25.    inary%(0) = &h0200
  26.    inary%(3) = err.code% - 1
  27.    err.code% = 0
  28.  
  29.    call int86(23,varptr(inary%(0)),varptr(outary%(0)))
  30.  
  31.    err.code% = 1
  32.    a = outary%(0)
  33.    a = (a / 256) and 255
  34.    if a = &h90 then err.code% = 0
  35.    if (a and &h8)  = 8  then err.code% = 8  'Printer I/O Error
  36.    if (a and &h20) = 32 then err.code% = 32 'The Printer is Out Of Paper
  37.    if (a and &h10) = 0  then err.code% = 16 'The Printer is Off Line
  38. end sub
  39.  
  40.